//自选基金涨跌幅获取：/get-optional-change-nav
import http from 'k6/http';
import { sleep } from 'k6';
import { URL } from './config.js';

export const options = {
    vus:1000,
    duration:'60s'
};

export default function () {
    const url=`${URL}/api/get-optional-change-nav`;
    const payload=JSON.stringify(
    {
        "codeArr":["018957","002317","161716","016173","016179","023766","000496","240011","008021","008129","020989","003096","015756","320007","015877","012980","020629","007519","023552","110007","018133","018489","008253","023763","161723","006479","021534","023567","023350","025167","011611","001595","012929","017223","014766","014674","016778","003864","161720","217008","015736","006331","007540","001753","018125","019671","017811","008888","016387","020398","020137","018590","010591","024424","024419","011452","018994","016371","022365","006760","016496","015968","023408","017103","011320","007195","014332","516780","012622","006980","016561","012414","017437","005827","003547","004253","011786","011175","518850","008143","518800","162703","021831","001475","011102","009823","012417","023782","011609","014855","501225"],
        "dataResources":"3",
        "dataSourceSwitch":true,
        "valuationDate":"2025-10-13",
        "navDate":"2025-10-10",
        "isTD":true,
        "sort":{"attr":"dailyYield","sort":"asc","src":"top.png"},
        "unionId":"o896o5_scUqyJKkRTR1z9Wbm4V98",
        "version":"3.4.0.X"}
    );
  const res = http.post(url,payload,{headers:{'Content-Type': 'application/json' }});
  console.log('状态码:', res.status);   // 200
  console.log('返回体:', res.body);     // 原始字符串
  // sleep() 函数作为多个串联请求的思考时间
  sleep(1);
}